#ifndef __BYTE_RING_BUFFER_H__
#define __BYTE_RING_BUFFER_H__ 1

#include <valarray>

class CByteRingBuffer {
public:
	std::valarray<unsigned char> mBuffer;
	
	CByteRingBuffer(unsigned int pSize);
	virtual ~CByteRingBuffer();

	void put(unsigned char pValue);
	void put(void* pValues, unsigned int pCount);

	/**
	 * @param pClean true for removing from ring buffer
	 * @return count of stored values
	 */
	unsigned int get(void* pDst, unsigned int pCount, bool pClean = true);

	int getIndex(int pOffset);
	unsigned int clean(unsigned int pCount);
	bool cleanFirst();
	unsigned int len();
	unsigned int size();

private:
	unsigned int mPut, mGet;
	bool mFull;
};

#endif // __BYTE_RING_BUFFER_H__

